from urllib.request import urlopen

url = 'http://www.baidu.com'

res = urlopen(url)

with open('mybaidu.html', 'w', encoding='utf-8') as f:
    # decode 解码
    f.write(res.read().decode('utf-8'))
print('over')


